package org.sith.taskrunner.ejb.services;

import org.sith.taskrunner.api.toolkit.TaskToolkit;
import org.sith.taskrunner.api.user.Role;
import org.sith.taskrunner.ejb.annotations.AllowedRoles;
import org.sith.taskrunner.ejb.db.entity.TaskToolkitEntity;
import org.sith.taskrunner.ejb.exceptions.TaskToolkitRegisterException;

import javax.ejb.Local;
import java.util.List;
import java.util.Set;

@Local
public interface
        TaskToolkitRegisterService {
    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void registerToolkitBuilder(TaskToolkitEntity taskToolkit) throws TaskToolkitRegisterException;

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void unregisterToolkitBuilder(TaskToolkitEntity toolkit);

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void activateToolkitBuilder(TaskToolkitEntity toolkit) throws TaskToolkitRegisterException;

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void deactivdateToolkitBuilder(TaskToolkitEntity toolkit) throws TaskToolkitRegisterException;

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void activateAllToolkitBuilders();

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void deactivateAllToolkitBuilders();

    List<String> getToolkitBuilderNames(Class<? extends TaskToolkit> clazz);

    public TaskToolkitEntity getActiveToolkit(String name, Double version);
    
    List<String> getAllToolkitBuilderNames();

    List<String> getActiveToolkitsNames();

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void deactivateToolkitBuilders(Class<? extends TaskToolkit> clazz) throws TaskToolkitRegisterException;

    boolean isToolkitRegistered(String builderName);

    @AllowedRoles({Role.TASK_OWNER, Role.ADMIN})
    void clearToolkits();

    List<TaskToolkit> getSystemToolkits();

    List<TaskToolkit> getActiveToolkits();

    List<TaskToolkit> getAllToolkits();
}


